package com.aistar.mapper;

import com.aistar.model.entity.EmployeeBlacklist;
import com.aistar.model.entity.EmployerBlacklist;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName: EmployeeBlacklistMapper
 * @author: LiuWenXiu
 * @date: 2021/9/26 20:06
 * @Description: TODO...
 */
public interface EmployerBlacklistMapper {

    // 根据id获取EmployerBlacklist
    @Select("select * from employer_blacklist where id = #{id}")
    EmployerBlacklist findById(Integer id);

    // 根据招聘者id获取该招聘者屏蔽的求职者
    @Select("select * from employer_blacklist where employer_id = #{id}")
    List<EmployerBlacklist> findByEmployerId(Integer id);

    // 根据id删除EmployerBlacklist
    @Delete("delete from employer_blacklist where id = #{id}")
    int delById(Integer id);

    // 创建黑名单
    @Insert("insert into employer_blacklist(employer_id,employee_id) values(#{employerId},#{employeeId})")
    int insertBlacklist(@Param("employerId") Integer employerId, @Param("employeeId") Integer employeeId);

    // 根据招聘者id获取该招聘者屏蔽的所有求职者id
    @Select("select employee_id from employer_blacklist where employer_id = #{employerId}")
    List<Integer> findEmployeeIdByEmployerId(Integer employerId);

}
